<template>
	<!-- 请选择体检人 -->
	<view class="main">
		<view class="text">请选择体检人</view>
		<view class="person">
			<view class="item" @click="tiaoZhuan(item.patients_id)" v-for="item in arr">
				<view class="personItem">
					<view class="name">
						<text>{{item.patients_name}}</text>
						<text class="tag">{{item.relationship}}</text>
					</view>
					<view class="idCard">{{item.patients_id_number}}</view>
				</view>
				<view class="personItem2">默认就诊人</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {ref,reactive,toRefs} from 'vue'
	export default {
		setup() {
			const data=reactive({
				arr:[]
			})
			const getPatients=()=>{
				uni.request({
				    url: 'http://localhost:3000/getAppointmentMedical', 
					data:{id:1},
				    success: (res) => {
				        // console.log(res.data.data);
				        data.arr = res.data.data;
						console.log(data.arr);
					}
				});
			}
			getPatients();
			
			const tiaoZhuan=(val)=>{
				let arr2=data.arr;
				// console.log(arr2)
				uni.setStorageSync('list', arr2);
				uni.navigateTo({
					url: `/pages/home/bodyExamine/examinationAppointment/examinationAppointment?id=${val}`
				});
			}
			return {...toRefs(data),tiaoZhuan}
		}
	}
</script>

<style>
	.main{
		padding: 30rpx;
		box-sizing: border-box;
		/* border: 1px solid red; */
		display: flex;
		flex-direction: column;
	}
	.text{
		padding: 0 0 30rpx 0;
	}
	.item{
		margin-bottom: 30rpx;
		border: 1px solid gainsboro;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		height: 200rpx;
		background-color: #F5F9FF;
		padding: 20rpx;
		box-sizing: border-box;
		border-radius: 20rpx;
	}
	.personItem{
		display: flex;
		flex-direction: column;
		/* justify-content:space-evenly; */
		
	}
	.name{
		padding-bottom: 20rpx;
		box-sizing: border-box;
	}
	.tag{
		border-radius: 20rpx;
		background-color: #E2EDFE;
		padding: 2rpx 15rpx;
		box-sizing: border-box;
		font-size: 25rpx;
		color: #2E88FF;
		margin-left: 20rpx;
	}
	.idCard{
		color: #939598;
		font-size: 25rpx;
	}
	.personItem2{
		color: #939598;
		font-size: 25rpx;
		position: absolute;
		top: 160rpx;
		right: 50rpx;
	}
</style>
